package ink.lovejinhu.think.dp;

/**
 * @author jinhu
 * created 2021-08-18 11:24
 */
public class Solution_0509 {
    public int fib(int n) {
        if (n == 0) return 0;
        int f0 = 0;
        int f1 = 1;
        for (int i = 2; i <= n; i++) {
            int f2 = f0 + f1;
            int temp = f0;
            f0 = f1;
            f1 = f2;

        }
        return f1;
    }
}
